Annotating a generator output stream

ABSTRACT

A code annotating system includes a code wrapper engine, an annotator engine, and a memory device. The code wrapper engine receives an output stream produced by a source code of a generator. The code wrapper engine also wraps the output stream to produce a copy of the output stream. The annotator engine automatically annotates the copy with source information. The source information maps a relationship between data in the output stream and the source code of the generator. The memory device stores the source information.

BACKGROUND

Software is used to produce complex documents in many different usecases, such as using a source generator whose output is source code insome target language. Other examples include software that producesPortable Document Format (PDF) files, software that generates structuredcontent such as Hypertext Markup Language (HTML) or Extensible MarkupLanguage (XML), utilities that produce reports from various inputs, andutilities that convert from one file format to another. Somegraphics-oriented examples include software that produces complexvisualizations such as heat maps, or software that algorithmicallygenerates music in standard notation. The generated documents mayinclude text, symbols, and/or graphic elements.

These generators are often complex and include many thousands of linesof code, and thus may be difficult to develop, debug, and maintain.Developers working on such applications may require lengthy training andfamiliarization, resulting in low productivity, even while relying onmore experienced developers and test automation. For commercialapplications, this may create a very small pool of talent that must benurtured and about whom retention may be a constant concern. For opensource applications, this creates a serious impediment to theapplication's ability to attract developer interest and generatemomentum.

SUMMARY

Embodiments of a system are described. In one embodiment, the system isa code annotating system. The system includes: a data storage deviceconfigured to: store a table having data values in a column major order,wherein the data values are stored in a list of blocks; and a tablemanagement engine configured to: a code wrapper engine configured to:receive an output stream produced by a source code of a generator; andwrap the output stream to produce a copy of the output stream; anannotator engine configured to: automatically annotate the copy withsource information, wherein the source information maps a relationshipbetween data in the output stream and the source code of the generator;and a memory device configured to store the source information. Otherembodiments of the system are also described.

Other aspects and advantages of embodiments of the present inventionwill become apparent from the following detailed description, taken inconjunction with the accompanying drawings, illustrated by way ofexample of the principles of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts a schematic diagram of one embodiment of a codeannotating system.

FIG. 2 depicts a schematic diagram of one embodiment of the codeannotating system of FIG. 1.

FIG. 3 depicts a schematic diagram of one embodiment of the codeannotating system of FIG. 1.

FIG. 4 depicts a schematic diagram of one embodiment of an annotatedoutput document.

FIG. 5 depicts one embodiment of a method for annotating document sourcecode.

Throughout the description, similar reference numbers may be used toidentify similar elements.

DETAILED DESCRIPTION

It will be readily understood that the components of the embodiments asgenerally described herein and illustrated in the appended figures couldbe arranged and designed in a wide variety of different configurations.Thus, the following more detailed description of various embodiments, asrepresented in the figures, is not intended to limit the scope of thepresent disclosure, but is merely representative of various embodiments.While the various aspects of the embodiments are presented in drawings,the drawings are not necessarily drawn to scale unless specificallyindicated.

The present invention may be embodied in other specific forms withoutdeparting from its spirit or essential characteristics. The describedembodiments are to be considered in all respects only as illustrativeand not restrictive. The scope of the invention is, therefore, indicatedby the appended claims rather than by this detailed description. Allchanges which come within the meaning and range of equivalency of theclaims are to be embraced within their scope.

Reference throughout this specification to features, advantages, orsimilar language does not imply that all of the features and advantagesthat may be realized with the present invention should be or are in anysingle embodiment of the invention. Rather, language referring to thefeatures and advantages is understood to mean that a specific feature,advantage, or characteristic described in connection with an embodimentis included in at least one embodiment of the present invention. Thus,discussions of the features and advantages, and similar language,throughout this specification may, but do not necessarily, refer to thesame embodiment.

Furthermore, the described features, advantages, and characteristics ofthe invention may be combined in any suitable manner in one or moreembodiments. One skilled in the relevant art will recognize, in light ofthe description herein, that the invention can be practiced without oneor more of the specific features or advantages of a particularembodiment. In other instances, additional features and advantages maybe recognized in certain embodiments that may not be present in allembodiments of the invention.

Reference throughout this specification to “one embodiment,” “anembodiment,” or similar language means that a particular feature,structure, or characteristic described in connection with the indicatedembodiment is included in at least one embodiment of the presentinvention. Thus, the phrases “in one embodiment,” “in an embodiment,”and similar language throughout this specification may, but do notnecessarily, all refer to the same embodiment.

While many embodiments are described herein, at least some of thedescribed embodiments present a system and method for annotatingdocument source code in an output stream of a generator. Morespecifically, the system generates a copy of the output stream togenerate an annotated output document that describes relationshipsbetween code fragments in the output stream and statements 128 in asource code of the generator. The statements 128 related to a given codefragment may be displayed in a call stack or call graph on a displaydevice when the code fragment is highlighted to show the call order thatcreated the given code fragment.

Some conventional systems may require developers to use a debugger tostep through a generator's complex source code to pinpoint any problemsthat may be discovered. Other conventional systems may includeimplementing the generator's source code with trace information fornoting where problems or potential problems are occurring. Correctingproblems in such conventional systems may be time consuming and errorprone, which can lower productivity. In some systems, formal grammarsmay be created that define the generator's input and output, andpossibly validate the generator's output by analyzing the input andoutput grammars. In practice, this can be problematic because itrequires very highly specialized skills to create these grammars and canbe very costly to maintain.

A system for generating an annotated output document that maps the codefragments in the output document to statements in the generator sourcecode may provide a quick, easy way to analyze and correct the generatorsource code. Automatically annotating the output stream of the generatormay also improve developer productivity and expedite the “time-to-value”of developers who are new to the generator codebase. Developers may takean incremental, outside-in approach to learning the codebase by focusingon what the generator produces rather than having to internalize itsarchitecture and the architecture of the data with which the generatorworks. Furthermore, automating the system allows the generator to evolveover time, such that the generator logic may be freely changed, and theannotation mechanism may still augment the generator source code.

FIG. 1 depicts a schematic diagram of one embodiment of a codeannotating system. The depicted code annotating system 100 includesvarious components, described in more detail below, that are capable ofperforming the functions and operations described herein. In oneembodiment, at least some of the components of the code annotatingsystem 100 are implemented in a computer system. For example, thefunctionality of one or more components of the code annotating system100 may be implemented by computer program instructions stored on acomputer memory device 102 and executed by a processing device 104 suchas a CPU. The code annotating system 100 may include other components,such as a disk storage drive 108, input/output devices 106, a codewrapper engine 110, an annotator engine 112, and a display engine 114.Some or all of the components of the code annotating system 100 may bestored on a single computing device or on a network of computingdevices, including a wireless communication network. The code annotatingsystem 100 may include more or fewer components or subsystems than thosedepicted herein. In some embodiments, the code annotating system 100 maybe used to implement the methods described herein as depicted in FIG. 5.

In one embodiment, the code annotating system 100 receives the outputstream 116 of a generator 118. In one embodiment, the generator 118 is aspecialized generator 118 configured to convert the source document froma source coding language to a target coding language. Because convertingdocuments from one coding language to another requires mapping each ofthe statements 128 and subroutines between the source and target codinglanguages, the source code of the generator 118 may have thousands oflines of coding. Alternative embodiments of generators 118 may produceother types of output streams 116 and complex documents, such as vectorgraphics, and thus may also require many lines of source code.

The code wrapper engine 110 wraps the output stream 116 to create a copy120 of the output stream 116. In one embodiment, wrapping the outputstream 116 may be optionally enabled. For example, wrapping the outputstream 116 may be enabled only during development of the generator andgenerally disabled in actual production use. Disabling wrapping duringuse may allow the generator 118 to operate faster than if wrapping isenabled. The annotator engine 112 annotates the output stream copy 120with source information 122 that includes a relationship between theoutput stream 116 and the source code of the generator 118. This may beachieved by collecting and analyzing a call stack 124 associated witheach code fragment 126 in the output stream 116, and filtering the callstack 124 to augment the copy 120 with annotations about how the contentin the copy 120 was produced. The call stack 124 contains statements 128from the source code that, in combination, produce a specific codefragment 126 in the output stream 116. Any output emitted anywherewithin the generator 118 may be automatically annotated.

In some embodiments, the annotator engine 112 also annotates the outputstream copy 120 with additional state information 130 that correspondsto a source document that is input into an input stream of the generator118. In some embodiments, the annotator engine 112 annotates the outputstream copy 120 only with information from the source code that issemantically relevant to the output stream 116 and excludes anyinformation from the generator 118 that does not emit content.

In one embodiment, the display engine 114 is configured to display thecall stack 124 for a code fragment 126 on an output device 106 such as adisplay device when the user performs a cursor action 132 on the codefragment 126. The call stack 124 may be displayed in a popup window ordialog proximate the cursor or the highlighted code fragment 126 on thedisplay device in some embodiments. In one embodiment, the call stack124 is displayed in a call order in which each statement 128 orsubroutine that is called to produce the code fragment 126 is displayedin the order in which it is called. The statements 128 may be annotatedwith the corresponding line numbers from the source code, allowing adeveloper inspecting the annotations to quickly find the statements 128in the source code for debugging or other purposes. This provides a verynatural workflow by allowing the developer to run the generator 118 andlook at the resulting documents with overlays illustrating the capturedannotations.

FIG. 2 depicts a schematic diagram of one embodiment of the codeannotating system 100 of FIG. 1. In one embodiment, the code annotatingsystem 100 includes a generator 118 that receives an input from a sourcedocument 200 or other input source. For example, the source document 200may be a document containing code from a source coding language that isto be converted into a target coding language.

The source document 200 is input into an input stream of the generator118. In some embodiments, the generator 118 may accept multiple sourcedocuments 200 that contain code written in the same source codinglanguage. The generator 118 may include source code configuredspecifically for the source coding language in the source documents 200.The generator source code may be configured to convert the code from thesource document 200 into the target coding language through numerousprocesses or subroutines. Because the generator source code may berequired to map any potential subroutines, objects, or other elements inthe source coding language to the target coding language, the generatorsource code may have many lines of code and be very complex.

In one embodiment, the generator source code converts the sourcedocument 200 into the target coding language and outputs the convertedcode into an output stream 116 that is written to one or more outputdocuments 200. The code annotating system 100 intercepts the outputstream 116 and wraps the output stream 116 to create a stream copy 120.The stream copy 120 may then be annotated by the code annotating system100 to create an annotated output document 204. In one embodiment, theannotated output document 204 includes all of the data from the outputstream 116, plus all of the annotations added in the stream copy 120.The annotated output document 204 may be linked to the output document200, such that the annotated output document 204 is able to use datafrom the output document 200 that may not be contained in the annotatedoutput document 204.

FIG. 3 depicts a schematic diagram of one embodiment of the codeannotating system 100 of FIG. 1. The code annotating system 100 mayinclude components in addition to the generator 118 and output streams116. In some embodiments, the code annotating system 100 includescomponents or processing stages between the source document 200 and thegenerator 118. The code annotating system 100 may also include more thanone generator 118, each having an output stream 116 and an output streamcopy 120. Each generator 118 may be configured to convert the sourcedocument 200 into a different target coding language or into a differentkind of output document 200, depending on the implementation of thegenerator 118.

In one embodiment, the source document 200 is input into a compiler 300to compile the code in the source document 200 into an intermediaterepresentation 302 of the source document 200. The compiler 300 maytranslate the code from the source coding language, which may be ahigh-level programming language, to a lower level programming language,such as assembly language or machine code. In some embodiments, the codeannotating system 100 may perform additional processes on the code inthe intermediate representation 302.

The intermediate representation 302 may then be input into an inputstream of each generator 118 to be converted into the respective targetcoding languages associated with the generators 118. Each generator 118produces an output stream 116 configured that may be used to produce anoutput document 200 or to display on a display device. The codeannotating system 100 wraps each output stream 116 produced by thegenerators 118 and creates corresponding stream copies for inserting anddisplaying annotations. The annotations may describe a relationshipbetween the data in the output streams 116 and the corresponding sourcecode of the generators 118.

In some embodiments, the code annotating system 100 may include morethan one compiler 300 configured to compile more than one sourcedocument 200. The compilers 300 may be configured to compile code fordifferent source coding languages corresponding to the different sourcedocuments 200. The compilers 300 may then output each of the sourcedocuments 200 as intermediate representations 302. The intermediaterepresentations 302 may then be input into the generators 118 to convertthe intermediate representations 302 into the corresponding targetcoding languages. Information from the intermediate representations 302may also be part of the annotations. This may allow developers who ownthe intermediate representations 302 and the source that produces theintermediate representations 302 to find and fix errors. This may alsoallow developers to ensure that the generator 118 is receiving theproper inputs and producing the correct outputs for the correspondinginputs. In various embodiments of the code annotating system 100, thecode annotating system 100 may include more or fewer components thandescribed herein. Processes or alterations other than those describedherein may be made to the data from the source document 200 or to datainput into the generators 118.

FIG. 4 depicts a schematic diagram of one embodiment of an annotatedoutput document 204. While the code annotating system 100 is describedherein in conjunction with the annotated output document 204 of FIG. 4,the code annotating system 100 may be used in conjunction with anyannotated output document 204 or user interface for displaying codeannotations.

In one embodiment, the annotated output document 204 is displayed on adisplay device 400 that is viewable to a user such as a developer. Thismay allow the user to view the output document 200 or output stream 116produced by the generator source code and to analyze the code in thetarget coding language. The code annotating system 100 also insertssource information into the output stream 116 so that the user is ableto view relationships between data in the output stream 116 and data inthe generator source code.

In one embodiment, the output document 200 is displayed in aninteractive format on the display device 400 that allows the user toscroll through the code and select individual code fragments 126. Whenthe user selects a code fragment 126 via a cursor action 132, such as amouse over event or mouse click event on the code fragment 126, the codefragment 126 may be highlighted on the display device 400. The codeannotating system 100 also displays any annotations corresponding to theselected code fragment 126 on the display device 400. The annotationsmay be displayed anywhere on the display device 400. For example, theannotations may be displayed proximate the code fragment 126 in a popupdialog window. The annotations include source information 122 from thegenerator source code.

In one embodiment, the source information 122 includes a call stack 124that displays statements 128 from the generator source code relating tothe selected code fragment 126 from the output stream 116. Thestatements 128 in the call stack 124 may be displayed in a call order ora reverse call order to allow the user to easily trace through thestatements 128 or subroutines that were called to produce the selectedcode fragment 126. The call stack 124 may also display the line numbersfor the statements 128 in the call stack 124 corresponding to thelocation of the statements 128 in the generator source code. The usermay be able to use the line numbers to find the statements 128 in thegenerator source code and modify or correct the source code if the userdetermines that the output stream 116 has errors. The annotations helpthe user understand the high-level flow within the generator 118 foreach produced code segment.

FIG. 5 depicts one embodiment of a method 500 for annotating documentsource code. Although the method 500 is described in conjunction withthe code annotating system 100 of FIG. 1, embodiments of the method 500may be implemented with other types of code annotating systems 100.

In one embodiment, the code annotating system 100 or a component in thecode annotating system 100 receives 505 an output stream 116 produced bythe source code of the generator 118. The system wraps 510 the outputstream 116 to produce a copy 120 of the output stream 116. The systemautomatically annotates 515 the copy 120 with source information 122,which maps a relationship between data in the output stream 116 and thegenerator source code. The source information 122 is stored 520 on amemory device 102.

In one embodiment, the system annotates the stream copy 120 with thesource information 122 by only including information from the generatorsource code that is semantically relevant to the output stream 116. Thegenerator source code may include functions or subroutines that performprocesses internal to the generator 118 and that do not have an effecton content in the output stream 116. Examples of such functions includeutility and infrastructure functions that do not contribute meaningfullyto the understanding of the output stream 116. Excluding such data fromthe source information 122 helps provide clear annotations in the outputstream 116.

In one embodiment, the system also captures additional state information130 corresponding to a source document 200 that is input into thegenerator 118 at an input stream and is used by the generator 118 toderive the content in the output stream 116. The output stream 116 isannotated with the additional state information 130. Informationrelating to the source document 200 may help understand the processesperformed by the generator 118 to produce the data in the output stream116. Any input streams into the generator 118 may be wrapped such thatthe annotation information can capture the fragment 126 of the inputstream associated with one or more output fragments 126. The fragment126 of the input stream may be automatically annotated to the copy 120of the output stream 116. In other embodiments, the generator 118 mayreact to data structures (rather than streams). In such embodiments, thearguments to the functions of the generator 118 may be captured byoverriding method invocation at a common point (as may be the case insome architectures) or by using aspect-oriented technology. Whether thegenerator 118 is stream- or data-oriented, once the input information iscaptured, the input information may be incorporated into the sourceinformation 122 associated with the emitted code fragment 126.

In some embodiments, the source information 122 includes a call stack124 that contains each statement 128 from the generator source code thatcorresponds to a code fragment 126 in the output stream 116. When thesystem detects 525 a cursor action 132 on the code fragment 126 in theoutput stream 116, the code fragment 126 is highlighted 530 on thedisplay device 400. The source information 122 is then displayed on thedisplay device 400. Displaying the source information 122 may includedisplaying 535 the call stack 124 that includes a line number for eachstatement 128 from the source code. The call stack 124 may be displayedin a call order or a reverse call order so that the user may easilytrack the series of calls that produce the highlighted code fragment126. In another embodiment, the source information 122 is displayed in acall graph that represents the relationships between subroutines in thesource code.

In one example of the system, the programming context includes alanguage that supports an ability to obtain a full stack trace at anypoint during execution. This ability may be leveraged to varying degreesin contexts that support a similar runtime reflection. By wrapping theoutput stream 116 and overriding the functions that produce output,callers to such functions are inherently the portions of the generator118 that emit content. This allows for automated annotation withoutrequiring any specific annotation logic in the generator 118.

Several different techniques for identifying the generator's callingfunction may be used. One example includes wrapping all of the methodsin the output stream 116 and incrementing a counter that tracks thestack depth. This may ensure that the non-relevant calls are filteredout even if the wrapped stream invokes some of its own methods. Anotherexample includes walking the stack trace to find the first entry notassociated with the wrapped output stream 116 or its base class. Anotherapproach includes analyzing the full stack trace with one or moreinclusive or exclusive criteria for filtering the full stack trace. Forexample, the logic for the generator 118 may all be associated with acertain package prefix, particularly if the wrapped output stream 116invokes some of its own methods. The name, function, and line number maybe collected for each stack entry that is determined to be relevant.This information may be associated with the code fragment 126 that isbeing output at that time.

After collecting the annotation information, the system presents theannotations to the developer. There are many potential embodiments toaddress different use cases, but each embodiment may share some commoncharacteristics. First, the system may be designed to associate eachfragment 126 of generated content with the generator source that emittedthe fragment 126 and to augment the association with a meaningful stacktrace so that the user is able to understand the high-level flow withinthe generator 118 at that point. As a result, various embodiments mayprovide some means of identifying a generated fragment 126, displayingthe precise source location that emitted the fragment 126, anddisplaying the filtered stack trace using some means of representation.

An embodiment of a code annotating system 100 includes at least oneprocessor coupled directly or indirectly to memory elements through asystem bus such as a data, address, and/or control bus. The memoryelements can include local memory employed during actual execution ofthe program code, bulk storage, and cache memories which providetemporary storage of at least some program code in order to reduce thenumber of times code must be retrieved from bulk storage duringexecution.

It should also be noted that at least some of the operations for themethods may be implemented using software instructions stored on acomputer useable storage medium for execution by a computer. As anexample, an embodiment of a computer program product includes a computeruseable storage medium to store a computer readable program that, whenexecuted on a computer, causes the computer to perform operations,including an operation to annotate document source code produced by agenerator 118.

Although the operations of the method(s) herein are shown and describedin a particular order, the order of the operations of each method may bealtered so that certain operations may be performed in an inverse orderor so that certain operations may be performed, at least in part,concurrently with other operations. In another embodiment, instructionsor sub-operations of distinct operations may be implemented in anintermittent and/or alternating manner.

Embodiments of the invention can take the form of an entirely hardwareembodiment, an entirely software embodiment, or an embodiment containingboth hardware and software elements. In one embodiment, the invention isimplemented in software, which includes but is not limited to firmware,resident software, microcode, etc.

Furthermore, embodiments of the invention can take the form of acomputer program product accessible from a computer-usable orcomputer-readable medium providing program code for use by or inconnection with a computer or any instruction execution system. For thepurposes of this description, a computer-usable or computer readablemedium can be any apparatus that can contain, store, communicate,propagate, or transport the program for use by or in connection with theinstruction execution system, apparatus, or device.

The computer-useable or computer-readable medium can be an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system(or apparatus or device), or a propagation medium. Examples of acomputer-readable medium include a semiconductor or solid state memory,magnetic tape, a removable computer diskette, a random access memory(RAM), a read-only memory (ROM), a rigid magnetic disk, and an opticaldisk. Current examples of optical disks include a compact disk with readonly memory (CD-ROM), a compact disk with read/write (CD-R/W), and adigital video disk (DVD).

Input/output or I/O devices (including but not limited to keyboards,displays, pointing devices, etc.) can be coupled to the system eitherdirectly or through intervening I/O controllers. Additionally, networkadapters also may be coupled to the system to enable the data processingsystem to become coupled to other data processing systems or remoteprinters or storage devices through intervening private or publicnetworks. Modems, cable modems, and Ethernet cards are just a few of thecurrently available types of network adapters.

In the above description, specific details of various embodiments areprovided. However, some embodiments may be practiced with less than allof these specific details. In other instances, certain methods,procedures, components, structures, and/or functions are described in nomore detail than to enable the various embodiments of the invention, forthe sake of brevity and clarity.

Although specific embodiments of the invention have been described andillustrated, the invention is not to be limited to the specific forms orarrangements of parts so described and illustrated. The scope of theinvention is to be defined by the claims appended hereto and theirequivalents.

What is claimed is:
 1. A computer program product, comprising: anon-transitory computer readable storage medium to store a computerreadable program, wherein the computer readable program, when executedby a processor within a computer, causes the computer to performoperations for annotating document source code, the operationscomprising: receiving an output stream of target coding languageconverted from source code input into a generator; wrapping the outputstream to produce a stream copy of the output stream, and producing anoutput document from the output stream; and automatically annotating thestream copy with source information to create an annotated outputdocument by: collecting a call stack associated with a code fragment inthe output stream; analyzing the call stack by excluding any informationthat does not emit content in the target coding language; and annotatingthe stream copy with the analyzed call stack, wherein the sourceinformation maps a relationship between the code fragment in theannotated output document and the source code, wherein the code fragmentis present in both the output document and the annotated outputdocument.
 2. The computer program product of claim 1, wherein the callstack comprises each statement from the source code that corresponds tothe code fragment in the annotated output document.
 3. The computerprogram product of claim 2, wherein the computer readable program, whenexecuted on the computer, causes the computer to perform additionaloperations, comprising: detecting a cursor action on the code fragmentin the annotated output document; highlighting the code fragment on adisplay device; and displaying the source information on the displaydevice in response to detecting the cursor action on the code fragmentin the annotated output document.
 4. The computer program product ofclaim 3, wherein displaying the source information further comprisesdisplaying the call stack, wherein the call stack further comprises aline number for each statement from the source code, wherein the callstack is displayed in a reverse call order.
 5. The computer programproduct of claim 2, wherein the computer readable program, when executedon the computer, causes the computer to perform additional operations,comprising: wrapping an input stream to the generator; capturing a codefragment of the input stream associated with the code fragment in theoutput stream; and automatically annotating the copy of the outputstream with the code fragment of the input stream.
 6. The computerprogram product of claim 1, wherein annotating the copy with the sourceinformation further comprises including only information from the sourcecode that is semantically relevant to the output stream by filtering thecall stack prior to annotating the stream copy with the sourceinformation.
 7. The computer program product of claim 1, wherein thecomputer readable program, when executed on the computer, causes thecomputer to perform additional operations, comprising: receiving asource document into the generator at an input stream; capturing a codefragment of the input stream associated with the code fragment in theannotated output document; capturing additional state informationcorresponding to the source document, wherein the source document isinput into the generator at the input stream; filtering the call stackprior to automatically annotating the stream copy with the sourceinformation; and annotating the stream copy of the output stream withthe additional state information.
 8. A code annotating system,comprising: a code wrapper engine configured to: receive an outputstream produced of target coding language converted from source codeinput into a generator; and wrap the output stream to produce a streamcopy of the output stream, and produce an output document from theoutput stream; an annotator engine configured to: automatically annotatethe stream copy with source information to create an annotated outputdocument by: collecting a call stack associated with a code fragment inthe output stream; analyzing the call stack by excluding any informationthat does not emit content in the target coding language; and annotatingthe stream copy with the analyzed call stack, wherein the sourceinformation maps a relationship between the code fragment in theannotated output document and the source code, wherein the code fragmentis present in both the output document and the annotated outputdocument; and a memory device comprising a non-transitory storage deviceconfigured to store the source information.
 9. The system of claim 8,wherein the call stack comprises each statement from the source codethat corresponds to the code fragment in the annotated output document.10. The system of claim 9, further comprising a display engineconfigured to: detect a cursor action on the code fragment in theannotated output document; highlight the code fragment on a displaydevice; and display the source information on the display device inresponse to detecting the cursor action on the code fragment in theannotated output document.
 11. The system of claim 10, whereindisplaying the source information further comprises displaying the callstack, wherein the call stack further comprises a line number for eachstatement from the source code, wherein the call stack is displayed in acall order.
 12. The system of claim 8, wherein annotating the copy withthe source information further comprises including only information fromthe source code that is semantically relevant to the output stream byfiltering the call stack prior to annotating the stream copy with thesource information.
 13. The system of claim 8, wherein the annotatorengine is further configured to: receive a source document into thegenerator at an input stream; capture a code fragment of the inputstream associated with the code fragment in the output stream; captureadditional state information corresponding to the source document,wherein the source document is input into the generator at the inputstream; filter the call stack prior to the annotation of the stream copywith the source information; and annotate the copy of the output streamwith the additional state information.